import { MidwayConfig } from "@midwayjs/core/dist";
import { UserEntity } from "../entity/user.entity";

export default {
  // use for cookie sign key, should change to your own and keep security
  keys: "1717657751791_4889",
  koa: {
    port: 7001,
  },
  typeorm: {
    dataSource: {
      default: {
        /**
         * 单数据库实例
         */
        type: "mysql",
        host: "127.0.0.1",
        port: 3306,
        username: "root",
        password: "root",
        database: "test_database",
        synchronize: false, // 如果第一次使用，不存在表，有同步的需求可以写 true，注意会丢数据
        logging: false,
        // 配置实体模型
        entities: [UserEntity],
      },
    },
  },
  jwt: {
    secret: "my-nodejs-project",
    // expiresIn: "2d",
    sign: {
      expiresIn: 60 * 5, // 5分钟, // https://github.com/vercel/ms
    },
  },
} as MidwayConfig;
